-- GENERATED SPELL FOR [Demetria] --


function spell0_12339(pUnit, Event) --@Dispel Magic,n/a--
pUnit:FullCastSpellOnTarget(17201,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 573, 1)
end

function spell1_12339(pUnit, Event) --@Dominate Mind,n/a--
pUnit:FullCastSpellOnTarget(14515,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 17000, 1)
end

function spell2_12339(pUnit, Event) --@Mind Blast,n/a--
pUnit:FullCastSpellOnTarget(17194,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 1500, 1)
end

function spell3_12339(pUnit, Event) --@Mind Flay,n/a--
pUnit:FullCastSpellOnTarget(17165,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 3000, 1)
end

function spell4_12339(pUnit, Event) --@Psychic Scream,Self--
pUnit:FullCastSpellOnTarget(13704,pUnit)
pUnit:RegisterEvent('Sorts_12339', 6341, 1)
end

function spell5_12339(pUnit, Event) --@Resurrect Trooper,n/a--
pUnit:FullCastSpellOnTarget(19721,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 632, 1)
end

function spell6_12339(pUnit, Event) --@Shadow Word: Pain,n/a--
pUnit:FullCastSpellOnTarget(17146,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_12339', 18000, 1)
end

function Sorts_12339(pUnit, Event)
local choix_sorts_12339 = math.random(0, 6)
if choix_sorts_12339 == 0 then
pUnit:RegisterEvent('spell0_12339', 1, 1)
end
if choix_sorts_12339 == 1 then
pUnit:RegisterEvent('spell1_12339', 1, 1)
end
if choix_sorts_12339 == 2 then
pUnit:RegisterEvent('spell2_12339', 1, 1)
end
if choix_sorts_12339 == 3 then
pUnit:RegisterEvent('spell3_12339', 1, 1)
end
if choix_sorts_12339 == 4 then
pUnit:RegisterEvent('spell4_12339', 1, 1)
end
if choix_sorts_12339 == 5 then
pUnit:RegisterEvent('spell5_12339', 1, 1)
end
if choix_sorts_12339 == 6 then
pUnit:RegisterEvent('spell6_12339', 1, 1)
end
end

function mob12339_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_12339', math.random(1500, 3000), 1)
end

function mob12339_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob12339_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob12339_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(12339, 1, 'mob12339_Action')
RegisterUnitEvent(12339, 2, 'mob12339_Leave')
RegisterUnitEvent(12339, 3, 'mob12339_Kill')
RegisterUnitEvent(12339, 4, 'mob12339_Die')
